﻿
//内容的html
var kfContentHtmlTemplate =
        "<table cellspacing='0' cellpadding='0' width='90' align='center' border='0' valign='top' style='height:60px'>"
        + "<tr style='height:10px'>"
        + "<td style='height:10px' height='30px' valign='top'>"
        + "<table cellspacing='0' cellpadding='0' width='90' border='0' style='height:10px'>"
        + "<tr>"
        + "<td align='center' style='white-space:nowrap;'>"
        + "<a target='_blank' href='http://wpa.qq.com/msgrd?v=3&uin=804390150&site=qq&menu=yes'><img border='0' src='http://wpa.qq.com/pa?p=2:804390150:41' alt='请联系我' title='请联系我'/></a>"
        + "</td>"
        + "</tr>"
        + "</table>"
        + "</td>"
        + "</tr>"
        +"</table>";

//客服飘窗的html
var kfHtmlTemplate =
     "<div id='kf_right' style='position:absolute;display:none'>"
    +"<table cellspacing='0' cellpadding='0' width='109' border='0'>"
    +"<tr>"
    + "<td colspan='3' style='background:url(\"kfimages/qq_top.gif\") 0 0 no-repeat;height:33px;'>&nbsp;</td>"
    +"</tr>"
    +"<tr>"
    + "<td width='6px' style='background:url(\"kfimages/qq_life.gif\") 0 0 no-repeat;height:33px;'>&nbsp;</td>"
    + "<td valign='top' width='96' style='height:100px;overflow:hidden; background-color:White;'>" + kfContentHtmlTemplate + "</td>"
    +"<td width='7px' style='background:url(\"kfimages/qq_right.gif\") 0 0 no-repeat;height:33px;'>&nbsp;</td>"
    +"</tr>"
    +"<tr>"
    + "<td colspan='3' style='background:url(\"kfimages/qq_bottom1.gif\") 0 0 no-repeat;height:30px;'>"
    + "</td></tr>"
    + "<tr><td colspan='3' style='background:url(\"kfimages/qq_logo.gif\") 0 0 no-repeat;height:33px;'>"
    +"</td></tr>"
    +"</table>"
    +"</div>";

//显示客服的飘窗
function ShowKFDiv() {
    document.body.innerHTML += kfHtmlTemplate;
};

//重绘div
function ResetKFDiv() {
    document.getElementById("kf_right").style.display = "";
    document.getElementById("kf_right").style.top = (document.documentElement.scrollTop + 160) + "px";
    document.getElementById("kf_right").style.left = (document.documentElement.scrollLeft + document.body.offsetWidth - 109) + "px";
};

function AsycResetKFDiv() {
    setTimeout("ResetKFDiv();", 10);
};

//折叠客服DIV
function CollapseKF() { 
    
};

ShowKFDiv();
//windows事件
window.onload = function () {
    AsycResetKFDiv();
};

window.onscroll = AsycResetKFDiv;
window.onresize = AsycResetKFDiv;